package com.woniu.service.command;

import com.woniu.outlet.elasticSearch.po.Fund;
import com.woniu.util.ApplicationContextHolder;
import lombok.Data;

import java.util.List;

/**
 * @description:
 * @author: my
 * @time: 2021/4/21 17:24
 */
@Data
public class FundQueryCommand {
    private FundQueryCommandHandler handler;
    private String type;
    private Integer pageNum;

    public FundQueryCommand(){
        this.handler =
                ApplicationContextHolder.getApplicationContext().getBean(FundQueryCommandHandler.class);
    }

    public FundQueryCommand(String type,Integer pageNum){
        this();
        this.type = type;
        this.pageNum = pageNum;
    }

    public List<Fund> execute() throws Exception {
        return this.handler.action(this);
    }
}
